/*
** xfunc.c for  in /home/lund/Projets/SysUnixAv/feutrace
** 
** Made by florian dewulf
** Login   <dewulf_f@epitech.net>
** 
** Started on  Sun Jun 23 18:32:12 2013 florian dewulf
** Last update Sun Jun 23 18:56:11 2013 florian dewulf
*/

#include	<stdio.h>
#include	<stdlib.h>
#include	"ftrace.h"

void		xerror(char *str)
{
  perror(str);
  exit(EXIT_FAILURE);
}

void		*xmalloc(unsigned int size)
{
  void		*ptr;

  ptr = malloc(size);
  if (ptr)
    return (ptr);
  xerror("malloc");
}

int		xopen(char *filename)
{
  int		fd;

  fd = open(filename, O_RDONLY);
  if (fd == -1)
    printf("Fail to open %s\n", filename);
  return (fd);
}
